package com.lagou.homework.model3;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * @author Hanpeng
 * @date 2021/12/23 19:58
 * @description:
 */
public class NumSortMapper extends Mapper<LongWritable, Text, IntWritable, NullWritable> {
    private IntWritable keyOut=new IntWritable();
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line = value.toString();
        int num = new Integer(line.trim());
        keyOut.set(num);
        context.write(keyOut,NullWritable.get());
    }
}
